﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameMain : MonoBehaviour
{

    public static GameObject GameUi;
    public static float StateTime1 = 3;//开场动画时间，默认显示3秒
    void Awake()
    {

    }

    // Use this for initialization
    void Start()
    {
        InitConfig();
        InitModels();
        GameUi = this.gameObject;
        UIManager.Instance.Init();
        StartCoroutine(StartAnim());
    }

    void InitConfig()
    {
        CharacterLevelConfig.Instance.Init();
    }

    void InitModels()
    {
        CharacterModel.Instance.Init();
        XiuXingModel.Instance.Init();
    }

    IEnumerator StartAnim()
    {
        UIManager.Instance.ShowPage(UINames.SplashPage);
        yield return new WaitForSeconds(StateTime1);
        UIManager.Instance.Switch2Default();
    }

    private void ExperienceGet()
    {
        if (CharacterModel.Instance.CalcEx())
        {
            MessageCenter.Instance.SendMessage(MessageConsts.EX_UPDATE);
        }

    }

    // Update is called once per frame
    void Update()
    {
        ExperienceGet();
    }
}
